﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="FunctionList.ascx.cs"
    Inherits="Admin_Components_Member_ListFunction" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<telerik:RadScriptManager ID="ScriptManager2" runat="server" EnableTheming="True">
</telerik:RadScriptManager>
<telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" Skin="Sunset" />
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadAjaxManager1" />
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function showForm(url) {
            window.radopen(url, "RadWindow1");
            return false;
        }
        function OnClientClose(oWnd, args, code, name) {
            var arg = args.get_argument();
            if (arg == '' || arg == null) {
            }
            else {
                $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(arg);
            }
        }
    </script>
</telerik:RadCodeBlock>
<telerik:RadWindowManager ID="RadWindowManager1" VisibleStatusbar="false" runat="server"
    Skin="Sunset" EnableShadow="true" DestroyOnClose="True" EnableAriaSupport="True">
    <Windows>
        <telerik:RadWindow ID="RadWindow1" runat="server" NavigateUrl="FunctionList.aspx"
            OnClientClose="OnClientClose">
        </telerik:RadWindow>
    </Windows>
    <Windows>
        <telerik:RadWindow ID="RadWindow2" runat="server" Height="500px" OnClientClose="OnClientClose"
            Width="700px">
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <div class="form-horizontal wrapper-center clearfix">
            <div class="form-group col-md-6">
                <div class="form-group">
                    <label class="col-md-4 control-label">
                        Method Name</label>
                    <div class="col-md-8">
                        <telerik:RadTextBox ID="txtMethodName" CssClass="col-imp-8 inputForm" Width="158" runat="server" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-4 control-label">
                        Chức năng cấp trên</label>
                    <div class="col-md-8">
                        <telerik:RadComboBox ID="cboParentID" runat="server" TabIndex="2" CssClass="col-imp-8">
                            <ItemTemplate>
                                <telerik:RadTreeView runat="server" ID="tvHierarchy" OnClientNodeClicking="rcbHierarchyClientClicking"
                                    OnNodeClick="cboParentID_SelectedIndexChanged" />
                            </ItemTemplate>
                        </telerik:RadComboBox>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-4 control-label">
                        Loại chức năng</label>
                    <div class="col-md-8">
                        <telerik:RadComboBox ID="cboFunctionType" runat="server" EmptyMessage="Chọn loại chức năng" CssClass="col-imp-8"
                            OnSelectedIndexChanged="cboFunctionType_SelectedIndexChanged" TabIndex="3" />
                    </div>
                </div>
            </div>
            <div class="form-group col-md-6">
                <div class="form-group">
                    <label class="col-md-4 control-label">
                        Tên chức năng</label>
                    <div class="col-md-8">
                        <telerik:RadTextBox ID="txtFunctionName" Width="158" runat="server" CssClass="col-imp-8 inputForm"
                            OnTextChanged="txtFunctionName_TextChanged" TabIndex="4" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-4 control-label">
                        Cấp chức năng</label>
                    <div class="col-md-8">
                        <telerik:RadComboBox ID="cboFunctionLevel" runat="server" EmptyMessage="Chọn cấp chức năng :" CssClass="col-imp-8"
                            OnSelectedIndexChanged="cboFunctionLevel_SelectedIndexChanged" TabIndex="5">
                            <Items>
                                <telerik:RadComboBoxItem runat="server" Text="-- Tất cả --" Value="" />
                                <telerik:RadComboBoxItem runat="server" Text="0" Value="0" />
                                <telerik:RadComboBoxItem runat="server" Value="1" Text="1" />
                                <telerik:RadComboBoxItem runat="server" Value="2" Text="2" />
                            </Items>
                        </telerik:RadComboBox>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-4 control-label">
                        Chức năng</label>
                    <div class="col-md-8">
                        <asp:RadioButton ID="radAll" runat="server" Checked="True" GroupName="ChucNang" OnCheckedChanged="radAll_CheckedChanged"
                            TabIndex="6" />
                        <asp:Label ID="lblAll" runat="server" Text="Tất cả" CssClass="lbl1" />
                        <asp:RadioButton ID="radSysFunction" runat="server" GroupName="ChucNang" OnCheckedChanged="radSysFunction_CheckedChanged"
                            TabIndex="7" />
                        <asp:Label ID="lblSystem" runat="server" Text="Hệ thống" CssClass="lbl1" />
                        <asp:RadioButton ID="radPublicFunction" runat="server" GroupName="ChucNang" OnCheckedChanged="radPublicFunction_CheckedChanged"
                            TabIndex="8" />
                        <asp:Label ID="lblList" runat="server" Text="Chung" CssClass="lbl1" />
                    </div>
                </div>
            </div>
        </div>
            <div class="set-btns text-center">
                <asp:Button ID="btnSearch" CssClass="btn btn-sm btn-primary" runat="server" Text="Tìm"
                    OnClick="btnSearch_Click" TabIndex="8" />
                <asp:Button ID="btnClear" CssClass="btn btn-sm btn-primary" runat="server" Text="Nhập lại"
                    OnClick="btnClear_Click" TabIndex="9" />
                <asp:Button ID="btnNew" runat="server" CssClass="btn btn-sm btn-primary" Text="Thêm mới"
                    OnClick="btnNew_Click" TabIndex="10" />
            </div>
        <div class="form-group text-right">
            <asp:Button ID="btnDelSelection" CssClass="btn btn-sm btn-warning" runat="server"
                Text="Xóa" OnClientClick="return ConfirmOnDelete('Bạn chắc muốn xóa những chức năng đã chọn ?');"
                OnClick="btnDelSelection_Click" TabIndex="11" />
        </div>
      <script type="text/javascript">
          function HeaderMenuShowing(sender, eventArgs) {
              if (eventArgs.get_gridColumn().get_uniqueName() == "STT") {
                  //hide the Clear sorting option from the header context menu of the column with name ContactName
                  eventArgs.get_menu().get_items().getItem(2).get_element().style.display = "none";
              }
          }
      </script>

            <telerik:RadGrid ID="grvData" runat="server" CellSpacing="0" CssClass=" table table-bordered" 
                EnableHeaderContextMenu="true" 
                GridLines="None" AutoGenerateColumns="False" HeaderStyle-HorizontalAlign="Center"
                OnItemCommand="grvData_ItemCommand" AllowMultiRowSelection="True" OnPageIndexChanged="grvData_PageIndexChanged"
                OnPageSizeChanged="grvData_PageSizeChanged" OnSelectedIndexChanged="grvData_SelectedIndexChanged"
                HeaderStyle-BorderStyle="None">
                <MasterTableView ShowHeader="true" AllowPaging="True" PageSize="20" NoMasterRecordsText="Không có dữ liệu."
                    ShowGroupFooter="true">
                    <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridTemplateColumn HeaderText="STT" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <%# Container.ItemIndex + 1 %></ItemTemplate>
                            <HeaderStyle Width="50px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn SortExpression="ID" HeaderText="Mã chức năng" ItemStyle-HorizontalAlign="Center"
                            HeaderButtonType="TextButton" DataField="ID" UniqueName="ID" Display="true">
                            <HeaderStyle HorizontalAlign="Center" Width="80px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="FunctionName" HeaderText="Tên chức năng"
                            HeaderButtonType="TextButton" DataField="FunctionName" UniqueName="FunctionName">
                            <HeaderStyle HorizontalAlign="Left" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="WebScreen" HeaderText=" Đường dẫn" HeaderButtonType="TextButton"
                            DataField="WebScreen" UniqueName="WebScreen" ItemStyle-HorizontalAlign="Left">
                            <HeaderStyle HorizontalAlign="Left" />
                            <ItemStyle HorizontalAlign="Left" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="FunctionType" HeaderText="Loại chức năng"
                            HeaderButtonType="TextButton" DataField="FunctionType" UniqueName="FunctionType"
                            ItemStyle-HorizontalAlign="Center" />
                        <telerik:GridBoundColumn SortExpression="IsCheck" HeaderText="Kiểm tra quyền"
                            HeaderButtonType="TextButton" DataField="IsCheck" UniqueName="IsCheck"
                            ItemStyle-HorizontalAlign="Center" />
                        <telerik:GridBoundColumn SortExpression="IsVisible" HeaderText="Hiển thị trên menu"
                            HeaderButtonType="TextButton" DataField="IsVisible" UniqueName="IsVisible"
                            ItemStyle-HorizontalAlign="Center" />
                        <telerik:GridBoundColumn SortExpression="Status" HeaderText="Trạng thái" HeaderButtonType="TextButton"
                            DataField="Status" UniqueName="Status" ItemStyle-HorizontalAlign="Center" />
                        <telerik:GridTemplateColumn DataField="IsSysFunction" SortExpression="IsSysFunction"
                            UniqueName="IsSysFunction" HeaderText="Hê thống" ItemStyle-HorizontalAlign="Center"
                            Display="false" HeaderStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:CheckBox ID="CheckBox1" Enabled="false" AutoPostBack="true" Checked='<%# Convert.ToBoolean(Eval("IsSysFunction")) %>'
                                    runat="server" />
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn UniqueName="Detail" HeaderText="Chi tiết" HeaderButtonType="TextButton"
                            ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:Button ID="lnkView" runat="server" CssClass="btnViewDetail" CommandArgument='<%# Eval("ID") %>'
                                    CommandName="ViewItem" />
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" Width="60px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn UniqueName="Edit" HeaderText="Sửa" HeaderButtonType="TextButton"
                            ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:Button ID="lnkEditDel" CssClass="btnDelete" CommandArgument='<%# Eval("ID") %>'
                                    CommandName="EditDelItem" runat="server"></asp:Button>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" Width="30px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridClientSelectColumn FilterControlAltText="Filter column1 column" UniqueName="checkbox"
                            HeaderText="Chọn">
                            <HeaderStyle HorizontalAlign="Center" Width="30px" />
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridClientSelectColumn>
                    </Columns>
                    <EditFormSettings>
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                        </EditColumn>
                    </EditFormSettings>
                </MasterTableView>
                <ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true">
                    <Selecting AllowRowSelect="true" />
                    <Resizing AllowRowResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True"
                        AllowColumnResize="True"></Resizing>
                </ClientSettings>
                <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                <FilterMenu EnableImageSprites="False">
                </FilterMenu>
                <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                </HeaderContextMenu>
            </telerik:RadGrid>
       
    </ContentTemplate>
</asp:UpdatePanel>
<div class="progressbar">
    <asp:UpdateProgress ID="up" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
        <ProgressTemplate>
            <div class="bg">
                <div class="progress progress-striped active">
                    <div class="progress-bar" role="progressbar" aria-valuenow="45" aria-valuemin="0"
                        aria-valuemax="100" style="width: 100%">
                        <span class="sr-only">100% Complete</span>
                    </div>
                </div>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
</div>
